public class demo1 {
    public String multiply(String num1, String num2) {
        int x=num1.length();
        int y=num2.length();
        char[]arr1=new StringBuilder(num1).reverse().toString().toCharArray();
        char[]arr2=new StringBuffer(num2).reverse().toString().toCharArray();

        int []arr=new int[x+y-1];
        for(int i=0;i<x;i++) {
            for(int j=0;j<y;j++) {
                arr[i+j]+=(arr1[i]-'0')*(arr2[j]-'0');
            }
        }
        StringBuilder stringBuilder=new StringBuilder();
        int ret=0;
        int left=0;
        while(ret!=0||left<arr.length) {
            if(left<arr.length)ret+=arr[left];
            left++;
            stringBuilder.append((char)(ret%10+'0'));
            ret/=10;
        }
        //注意翻转后面的后续操作
        while(stringBuilder.length()>1&&stringBuilder.charAt(stringBuilder.length()-1)=='0')stringBuilder.deleteCharAt(stringBuilder.length()-1);
        return stringBuilder.reverse().toString();
    }
}
